package com.aat.dxfy.javassist.test02;

import javassist.*;

public class Test02 {

	public static void main(String[] args) throws Exception {
		ClassPool pool = ClassPool.getDefault();
		CtClass cc = pool.makeClass("Foo");
		CtMethod mthd = CtNewMethod.make("public Integer getInteger() { return 111; }", cc);
		cc.addMethod(mthd);
		CtField f = new CtField(CtClass.intType, "i", cc);
		cc.addField(f);
		Class<?>  cls= cc.toClass(); 
		Object obj = cls.newInstance();
		obj.toString();
	}

}
